import Taro, {Component, Config} from "@tarojs/taro";
import {View, Swiper, SwiperItem, Image, Text, Form, Button} from "@tarojs/components";
import PageFooterInfo from '../../components/PageFooterInfo'

import './index.less'
import result from '../../assets/img/icon_30.png'
import bg_02 from '../../assets/img/bg_02.jpg'
import bg_03 from '../../assets/img/bg_03.jpg'
import bg_04 from '../../assets/img/bg_04.jpg'
import right from '../../assets/img/right.png'
import point_on from '../../assets/img/icon_23.png'
import line_on from '../../assets/img/icon_24.png'
import point from '../../assets/img/icon_25.png'
import line from '../../assets/img/icon_26.png'
import icon_26 from "../../assets/img/icon_26.png";
import {getRuntime} from "../../utils/common";


// 工程金融中心-计算结果
class Page1_step_two extends Component {
  constructor(props) {
    super(props)
  }

  state = {
    bfAmountOfMoney: '',
    freeAmountOfMoney: ''
  }

  componentWillMount(): void {
    Taro.setNavigationBarTitle({title: '工程保函中心'})
    let { bfAmountOfMoney,freeAmountOfMoney } = getRuntime().getStorage('projectInsurance')
    this.setState({
      bfAmountOfMoney,freeAmountOfMoney
    })
  }

  handelRouter(url: string = '/pages/index/index'): void {
    getRuntime().navigateTo(url)
  }

  render() {
    let { bfAmountOfMoney,freeAmountOfMoney }  = this.state
    return (
      <View className='result-wrap'>
        <View className='step-line'>
          <View className={'step-icon'}>
            <Image src={point_on} className={'point'}/>
            <Image src={line_on} className={'line'}/>
            <Image src={point_on} className={'point'}/>
            <Image src={line_on} className={'line'}/>
            <Image src={point} className={'point'}/>
          </View>
          <View className={'step-content'}>
            <Text className='title color-light'>保费计算</Text>
            <Text className='title color-light'>提交资料</Text>
            <Text className='title'>预约办理</Text>
          </View>
        </View>

        <Image src={result} className='result'/>

        <View className='item-wrap'>
          <View className='item-result'>
            <View className='item-title'>预计需要的保费金额:</View>
            <View className='item-price'>
              <Text className='price'>{bfAmountOfMoney}</Text>元
            </View>
            <View className='line' />
          </View>

          <View className='item-result'>
            <View className='item-title'>预计帮您免缴保证金总金额:</View>
            <View className='item-price'>
              <Text className='price'>{freeAmountOfMoney}</Text>元
            </View>
          </View>
          <View className='line' />
        </View>

        <PageFooterInfo />

        <View className='page-submit' onClick={this.handelRouter.bind(this, '/pages/finance/page1_step_three')}>提交资料</View>


      </View>
    )
  }
}

export default Page1_step_two
